package com.bianguo.android.apushdemo.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.bianguo.android.apushdemo.R;

import cn.zhouchaoyuan.excelpanel.BaseExcelPanelAdapter;

/**
 * Created by Administrator on 2017/10/23.
 */

public class ScheduleAdapter extends BaseExcelPanelAdapter<String, String, String> {

    private Context mContext;

    public ScheduleAdapter(Context context) {
        super(context);
        this.mContext = context;
    }

    @Override
    public RecyclerView.ViewHolder onCreateCellViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_schedule_left_layout, parent, false);
        return new NormalViewHolder(view);
    }

    @Override
    public void onBindCellViewHolder(RecyclerView.ViewHolder holder, int verticalPosition, int horizontalPosition) {
        NormalViewHolder viewHolder = (NormalViewHolder) holder;
        String s = majorData.get(verticalPosition).get(horizontalPosition);
        viewHolder.contentTv.setText(s);

    }

    @Override
    public RecyclerView.ViewHolder onCreateTopViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_schedule_left_layout, parent, false);
        return new TopViewHolder(view);
    }

    @Override
    public void onBindTopViewHolder(RecyclerView.ViewHolder holder, int position) {
        TopViewHolder viewHolder = (TopViewHolder) holder;
        String s = topData.get(position);
        viewHolder.contentTv.setText(s);
    }

    @Override
    public RecyclerView.ViewHolder onCreateLeftViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_schedule_left_layout, parent, false);
        return new LeftViewHolder(view);
    }

    @Override
    public void onBindLeftViewHolder(RecyclerView.ViewHolder holder, int position) {
        LeftViewHolder viewHolder = (LeftViewHolder) holder;
        String s = leftData.get(position);
        viewHolder.contentTv.setText(s);
    }

    @Override
    public View onCreateTopLeftView() {
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_schedule_left_layout, null);
        return view;
    }

    public static class TopViewHolder extends RecyclerView.ViewHolder {

        TextView contentTv;

        public TopViewHolder(View itemView) {
            super(itemView);
            contentTv = (TextView) itemView.findViewById(R.id.item_schedule_content);
        }
    }

    public static class NormalViewHolder extends RecyclerView.ViewHolder {

        TextView contentTv;

        public NormalViewHolder(View itemView) {
            super(itemView);
            contentTv = (TextView) itemView.findViewById(R.id.item_schedule_content);
        }
    }

    public static class LeftViewHolder extends RecyclerView.ViewHolder {

        TextView contentTv;

        public LeftViewHolder(View itemView) {
            super(itemView);
            contentTv = (TextView) itemView.findViewById(R.id.item_schedule_content);
        }
    }
}
